package com.chainyoung.component_tmperson.ui.mvp.presenter;

import com.chainyoung.common.appcommon.entity.Version;
import com.chainyoung.common.base.CommonSubscriber;
import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.mvp.BasePresenter;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.ui.mvp.contract.HdWalletContract;
import com.chainyoung.component_tmperson.ui.mvp.contract.HelpCenterContract;
import com.chainyoung.component_tmperson.ui.mvp.model.HdWalletModel;

import java.util.TreeMap;

import javax.inject.Inject;


public class HdWalletPresenter extends BasePresenter<HdWalletContract.Model, HdWalletContract.View> {

    @Inject
    public HdWalletPresenter(HdWalletContract.Model model, HdWalletContract.View rootView) {
        super(model, rootView);
    }


    public void getTransactions(String addr) {
        addSubscribe(mModel.getTransactions(addr)
                .compose(RxUtils.<String>rxSchedulerHelper())
                .subscribeWith(new CommonSubscriber<String>(mView) {
                    @Override
                    public void onNext(String data) {
                        mView.onGetTransactionsSuccessed(data);
                    }

                    @Override
                    public void onError(Throwable e) {
                        mView.onGetTransactionsFailed();
                        super.onError(e);
                    }
                }));
    }


}

